// Initializes the `admin` service on path `/admin`
const createService = require('feathers-mongoose')
const createModel = require('../../models/admin.model')
const hooks = require('./admin.hooks')

module.exports = function (app) {
  const Model = createModel(app)
  const paginate = app.get('paginate')

  const options = {
    name: 'admin',
    Model,
    paginate
  }

  // Initialize our service with any options it requires

  app.use('/admins', createService(options))


  // Get our initialized service so that we can register hooks and filters
  const service = app.service('admins')


  // app.use('/admin/find', {
  //   find: function (data) {
  //     return service.find(data).then(function (rs) {
  //       return rs
  //     })
  //   }
  // })

  service.hooks(hooks)
}
